<!--
  Generated template for the ShoppingCarPage page.

  See http://ionicframework.com/docs/components/#navigation for more info on
  Ionic pages and navigation.
-->
<ion-header>

  <ion-navbar>
    <ion-title>购 物 车</ion-title>
    <ion-buttons end>
      <button ion-button icon-only (click)="message()">
        <ion-icon name="ios-chatbubbles"></ion-icon>
      </button>
    </ion-buttons>

  </ion-navbar>

</ion-header>

<ion-content>
  <div class="no_data" *ngIf="!cartData">
    <ion-icon name="ios-cart-outline"></ion-icon>
    <div>购物车空空如也~~</div>
  </div>
  <div class="good_list" *ngIf="cartData">
    <ion-list>
      <ion-item-sliding *ngFor="let ele of cartData;index as i " #item>
        <ion-item>
          <ion-checkbox [(ngModel)]="ele.isChecked" (ngModelChange)="singleChange($event)"></ion-checkbox>
          <ion-label>
            <image tappable (click)='openDetail($event,ele.goods_id)' [src]="ele.picture_info.pic_cover_mid" alt=""></image>
            <div>
              <p class="name" tappable (click)='openDetail($event,ele.goods_id)'>{{ele.goods_name}}</p>
              <p class="type" *ngIf="ele.zhu">柱镜：{{ele.zhu}} / 球镜：{{ele.qiu}}</p>
              <p class="type" *ngIf="ele.sku_name">规格：{{ele.sku_name}}</p>
              <p class="price">价格：¥ {{ele.price}}</p>
            </div>

            <ion-icon class="delete" name="ios-trash" (click)="deleteCartConfirm(ele.cart_id)"></ion-icon>
            <div class="num">
              <ion-icon name="ios-remove-outline" (click)="changeNum(i,-1)"></ion-icon>
              <ion-input type="number" [(ngModel)]="ele.num" max="999" min="1" (ionBlur)="cartAdjustNum(i)"></ion-input>
              <ion-icon name="ios-add-outline" (click)="changeNum(i,1)"></ion-icon>
            </div>
            <!-- <div class="nums" *ngIf = "!isEditing">
                数量：{{ele.num}}
            </div> -->
          </ion-label>
        </ion-item>
        <ion-item-options side="right">
          <button ion-button color="private" (click)="addFav(item,ele.goods_id)">收 藏</button>
          <button ion-button color="danger" (click)="delete(item,ele.cart_id)">删 除</button>
        </ion-item-options>
      </ion-item-sliding>
    </ion-list>
  </div>
</ion-content>
<ion-footer class="check_out" *ngIf="cartData">
  <div>
    <p>
      <ion-checkbox [(ngModel)]="checkedAll" (ngModelChange)="allChange($event)"></ion-checkbox>
      全选
    </p>
    <span>
      <i>不含运费 </i> 总价:
      <b>¥ {{totalPrice}}</b>
    </span>
  </div>
  <p (click)="checkOut()">
    结 算
    <span>({{selectNum}})</span>
  </p>
</ion-footer>
